class Animal{
    name :string;
    constructor(theName: string){
        this.name=theName;
    }
    public move(distanceInMeters:number = 0){
        document.body.innerHTML=name+"速度:"+distanceInMeters;
    }
}

class Snake extends Animal{
    constructor(name: string){
        super(name);
    }
    public move(distanceInMeters:number = 5){
        document.body.innerHTML=name+"速度:"+distanceInMeters;
    }
}

class Dog extends Animal{
    constructor(name:string){
        super(name);
    }
    public move(distanceInMeters : number = 10){
        document.body.innerHTML=name+"速度:"+distanceInMeters;
    }
}

let sam = new Snake("samSnakey");
let tom:Animal = new Dog("tomDogey");
sam.move();
tom.move(31);